package com.example.project.dao;

import com.example.project.entity.TcdmSecureHazardList;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;

import java.time.LocalDate;
import java.util.Date;
import java.util.List;

/**
 * (TcdmSecureHazardList)表数据库访问层
 *
 * @author makejava
 * @since 2024-02-23 15:18:23
 */
public interface TcdmSecureHazardListDao {

    /**
     * 通过ID查询单条数据
     *
     * @param tshlId 主键
     * @return 实例对象
     */
    TcdmSecureHazardList queryById(Integer tshlId);

    /**
     * 查询指定行数据
     *
     * @param tcdmSecureHazardList 查询条件
     * @param pageable         分页对象
     * @return 对象列表
     */
    List<TcdmSecureHazardList> queryAllByLimit(@Param("tcdmSecureHazardList") TcdmSecureHazardList tcdmSecureHazardList, @Param("pageable") Pageable pageable, @Param("star")Date star,@Param("end")Date end);

    List<TcdmSecureHazardList> queryByCondition(@Param("tcdmSecureHazardList") TcdmSecureHazardList tcdmSecureHazardList);


    /**
     *  查询所有数据
     */
     List<TcdmSecureHazardList>  findList();
    /**
     * 统计总行数
     *
     * @param tcdmSecureHazardList 查询条件
     * @return 总行数
     */
    long count(TcdmSecureHazardList tcdmSecureHazardList);

    /**
     * 新增数据
     *
     * @param tcdmSecureHazardList 实例对象
     * @return 影响行数
     */
    int insert(TcdmSecureHazardList tcdmSecureHazardList);

    /**
     * 批量新增数据（MyBatis原生foreach方法）
     *
     * @param entities List<TcdmSecureHazardList> 实例对象列表
     * @return 影响行数
     */
    int insertBatch(@Param("entities") List<TcdmSecureHazardList> entities);

    /**
     * 批量新增或按主键更新数据（MyBatis原生foreach方法）
     *
     * @param entities List<TcdmSecureHazardList> 实例对象列表
     * @return 影响行数
     * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常，请自行校验入参
     */
    int insertOrUpdateBatch(@Param("entities") List<TcdmSecureHazardList> entities);

    /**
     * 修改数据
     *
     * @param tcdmSecureHazardList 实例对象
     * @return 影响行数
     */
    int update(TcdmSecureHazardList tcdmSecureHazardList);

    /**
     * 通过主键删除数据
     *
     * @param tshlId 主键
     * @return 影响行数
     */
    int deleteById(Integer tshlId);

    @Delete("delete from tcdm_secure_hazard_list where valid='0'")
    boolean deleteByValid();

    List<TcdmSecureHazardList> findByUnit(String tshaName);

    TcdmSecureHazardList getTrendCount( TcdmSecureHazardList tcdmSecureHazardList);

    Integer queryByState(TcdmSecureHazardList tcdmSecureHazardList);
}

